import axiosInstance from '@/utils/network/axios'
import type { AxiosResponse } from 'axios'

export interface ConfigurationItem {
    key: string
    value: string | boolean
    description: string
    active: boolean
    default: string | boolean
}

export async function axg_getOptions(type: 'global' | 'local_user' | 'virtual_user' | 'anonymous_user') {
    const response: AxiosResponse = await axiosInstance.get(`/home/options?type=${type}`)
    return response.data
}

export async function axp_switchOption(key: string) {
    const response: AxiosResponse = await axiosInstance.put(`/home/options?k=${key}`)
    return response.data
}

export async function apx_editOptionValue(k: string, v: string | any) {
    const object = { k, v }
    const response: AxiosResponse = await axiosInstance.post(`/home/options`, object)
    return response.data
}
